package top.lingkang.securityoauth2.server.config;

import top.lingkang.securityoauth2.core.AccessTokenHandle;
import top.lingkang.securityoauth2.core.DefaultAccessTokenHandleImpl;

/**
 * @author lingkang
 * Created by 2022/7/1
 * 参数配置类
 */
public class Oauth2ServerProperties {

    // 默认token 有效时间 30 分钟
    private long tokenValid = 30 * 60 * 1000L;

    // 默认刷新令牌有效时间 15 天
    private long refreshTokenValid = 15 * 24 * 60 * 60 * 1000;

    // 默认令牌获取方式
    private AccessTokenHandle accessTokenHandle = new DefaultAccessTokenHandleImpl();


    // -------------------------------------------------------------------

    public AccessTokenHandle getGetToken() {
        return accessTokenHandle;
    }

    public Oauth2ServerProperties setGetToken(AccessTokenHandle accessTokenHandle) {
        this.accessTokenHandle = accessTokenHandle;
        return this;
    }

    public long getTokenValid() {
        return tokenValid;
    }

    public Oauth2ServerProperties setTokenValid(long tokenValid) {
        this.tokenValid = tokenValid;
        return this;
    }

    public long getRefreshTokenValid() {
        return refreshTokenValid;
    }

    public Oauth2ServerProperties setRefreshTokenValid(long refreshTokenValid) {
        this.refreshTokenValid = refreshTokenValid;
        return this;
    }
}
